// main.js
import Vue from 'vue'
import App from './App.vue'
import store from './store'
import vSrc from '@/config/prototype.js'
import {OSS_URL} from "@/config/constant"; // 确保路径正确
import defaultImage from '@/static/img/default.png';

Vue.config.productionTip = false
Vue.directive('src', vSrc) // 注册指令
// main.js
Vue.prototype.getImageUrl = (path) => {
    if (!path) return defaultImage;
    if (/^(https?:|wxfile:)\/\//.test(path)) return path;
    return `${OSS_URL}/${path.replace(/^\//, '')}`; // 强制拼接并处理斜杠
};
const app = new Vue({ store, ...App })
app.$mount()